

#include "stdafx.h"
#include "TestDriver.h"
#include "CChannel.h"
#include "CAblationParameterEx.h"
#include "CEPTDeviceData.h"
#include "CSomeDataProcessor.h"

using namespace std;

CHAR DURATION[]		= "Duration";
CHAR TEMPERATURE[]	= "Temperature";
CHAR IMPEDANCE[]	= "Impedance";
CHAR CURRENT[]		= "Current";
CHAR VOLTAGE[]		= "Voltage";
CHAR POWER[]		= "Power";

VOID TestDriver::TestCChannel()
{
	CChannel l_objChannel;
	l_objChannel.UpdateParameter(DURATION,1);
	l_objChannel.UpdateParameter(TEMPERATURE,2);
	l_objChannel.UpdateParameter(IMPEDANCE,3);
	l_objChannel.UpdateParameter(CURRENT,4);
	l_objChannel.UpdateParameter(VOLTAGE,5);
	l_objChannel.UpdateParameter(POWER,6);

	cout<<"Temperature: "<<l_objChannel.GetParameter(TEMPERATURE)<<"\n";
	cout<<"Duration: "<<l_objChannel.GetParameter(DURATION)<<"\n";
	cout<<"Impedance: "<<l_objChannel.GetParameter(IMPEDANCE)<<"\n";
	cout<<"Current: "<<l_objChannel.GetParameter(CURRENT)<<"\n";
	cout<<"Voltage: "<<l_objChannel.GetParameter(VOLTAGE)<<"\n";
	cout<<"Power: "<<l_objChannel.GetParameter(POWER)<<"\n";

	cout<<"Key set[";

	list<string> l_lstParamList = l_objChannel.GetParameterList();
	list<string>::iterator itr = l_lstParamList.begin();
	for(;l_lstParamList.end() != itr;++itr)
	{
		cout<<*(itr)<<"  ";
	}
	cout<<" ]\n";


	//getchar();
}


VOID TestDriver::TestCAblationParameter(CAblationParameterEx & l_objAblParamEx)
{
	//CAblationParameterEx l_objAblParamEx;
	
	INT32 LOOP_COUNTER = 5;
	for(INT32 counter = 0 ; counter < LOOP_COUNTER ; counter++)
	{
		CChannel l_objChannel;
		l_objChannel.UpdateParameter(DURATION,counter);
		l_objChannel.UpdateParameter(TEMPERATURE,counter);
		l_objChannel.UpdateParameter(IMPEDANCE,counter);
		l_objChannel.UpdateParameter(CURRENT,counter);
		l_objChannel.UpdateParameter(VOLTAGE,counter);
		l_objChannel.UpdateParameter(POWER,counter);
		l_objAblParamEx.AddChannel(l_objChannel);

	}
	while(TRUE != l_objAblParamEx.IsListEmpty())
	{
		CChannel l_objChannel = l_objAblParamEx.GetNextChannel();
		cout<<"Temperature: "<<l_objChannel.GetParameter(TEMPERATURE)<<"\n";
		cout<<"Duration: "<<l_objChannel.GetParameter(DURATION)<<"\n";
		cout<<"Impedance: "<<l_objChannel.GetParameter(IMPEDANCE)<<"\n";
		cout<<"Current: "<<l_objChannel.GetParameter(CURRENT)<<"\n";
		cout<<"Voltage: "<<l_objChannel.GetParameter(VOLTAGE)<<"\n";
		cout<<"Power: "<<l_objChannel.GetParameter(POWER)<<"\n";
	}

	cout<<"Size of CAblation Parameters: " <<l_objAblParamEx.GetChannelCount()<<"\n";

}

VOID TestDriver::TestEPTDataConstructor()
{
	CEPTDeviceData l_objCEPTDeviceData;
}

VOID TestDriver::TestShifts()
{
	PBYTE l_pData  = new BYTE[2];
	SecureZeroMemory(l_pData,2);

	short l_sActualValue = 12119;

	l_pData[0] += l_sActualValue;
	l_pData[1] += l_sActualValue>>8;

	INT32 l_iValue = 0;
	l_iValue += l_pData[1];
	l_iValue = l_iValue<<8;
	l_iValue += l_pData[0];

	cout<<"Actual Value: "<<l_sActualValue<<  " Synthesized value :"<<l_iValue;
}

VOID TestDriver::TestDataProcessor()
{
	CAblationParameterEx l_objAblParamEx;
	
	INT32 LOOP_COUNTER = 5;
	for(INT32 counter = 0 ; counter < LOOP_COUNTER ; counter++)
	{
		CChannel l_objChannel;
		l_objChannel.UpdateParameter(DURATION,counter);
		l_objChannel.UpdateParameter(TEMPERATURE,counter);
		l_objChannel.UpdateParameter(IMPEDANCE,counter);
		l_objChannel.UpdateParameter(CURRENT,counter);
		l_objChannel.UpdateParameter(VOLTAGE,counter);
		l_objChannel.UpdateParameter(POWER,counter);
		l_objAblParamEx.AddChannel(l_objChannel);
	}

	{
		CChannel l_objChannel;
		INT32 counter = 45;
		l_objChannel.UpdateParameter(DURATION,counter);
		l_objChannel.UpdateParameter(TEMPERATURE,counter);
		l_objChannel.UpdateParameter(IMPEDANCE,counter);
		//l_objChannel.UpdateParameter(CURRENT,counter);
		//l_objChannel.UpdateParameter(VOLTAGE,counter);
		//l_objChannel.UpdateParameter(POWER,counter);
		l_objAblParamEx.AddChannel(l_objChannel);
	}
	{
		CChannel l_objChannel;
		INT32 counter = 67;
		//l_objChannel.UpdateParameter(DURATION,counter);
		//l_objChannel.UpdateParameter(TEMPERATURE,counter);
		//l_objChannel.UpdateParameter(IMPEDANCE,counter);
		l_objChannel.UpdateParameter(CURRENT,counter);
		l_objChannel.UpdateParameter(VOLTAGE,counter);
		l_objChannel.UpdateParameter(POWER,counter);
		l_objAblParamEx.AddChannel(l_objChannel);
	}


	CSomeDataProcessor l_objCSomeProcessor;
	l_objCSomeProcessor.Process(l_objAblParamEx);


}